<?php
class Application_Model_Factory_Registry
{
	/**
	 *
	 * @var Application_Model_Factory_MapperAbstract
	 */
	protected static $_mapperFactory;
	/**
	 *
	 * @var Application_Model_Factory_DomainAbstract
	 */
	protected static $_domainFactory;
	/**
	 *
	 * @var Application_Model_Factory_DbTableAbstract
	 */
	protected static $_dbTableFactory;
	/**
	 *
	 * @var Application_Model_Factory_Search_Index
	 */
	protected static $_indexFactory;
	/**
	 *
	 * @throws LogicException
	 * @return Application_Model_Factory_MapperAbstract
	 */
	public static function getMapperFactory ()
	{
		if (self::$_mapperFactory === null) {
			throw new LogicException(
				__METHOD__ . ', mapperFactory is not set'
			);
		}
		return self::$_mapperFactory;
	}
	/**
	 *
	 * @param Application_Model_Factory_MapperInterface $_mapperFactory
	 * @return void
	 */
	public static function setMapperFactory (Application_Model_Factory_MapperInterface $mapperFactory)
	{
		self::$_mapperFactory = $mapperFactory;
	}
	/**
	 *
	 * @throws LogicException
	 * @return Application_Model_Factory_DomainAbstract
	 */
	public static function getDomainFactory ()
	{
		if (self::$_domainFactory === null) {
			throw new LogicException(
				__METHOD__ . ', domainFactory is not set'
			);
		}
		return self::$_domainFactory;
	}
	/**
	 *
	 * @param Application_Model_Factory_DomainInterface $_domainFactory
	 * @return void
	 */
	public static function setDomainFactory (Application_Model_Factory_DomainInterface $domainFactory)
	{
		self::$_domainFactory = $domainFactory;
	}
	/**
	 *
	 * @throws LogicException
	 * @return Application_Model_Factory_DbTableAbstract
	 */
	public static function getDbTableFactory ()
	{
		if (self::$_dbTableFactory === null) {
			throw new LogicException(
				__METHOD__ . ', dbTableFactory is not set'
			);
		}
		return self::$_dbTableFactory;
	}
	/**
	 *
	 * @param Application_Model_Factory_DbTableInterface $_dbTableFactory
	 * @return void
	 */
	public static function setDbTableFactory (Application_Model_Factory_DbTableInterface $dbTableFactory)
	{
		self::$_dbTableFactory = $dbTableFactory;
	}
	/**
	 * Returns the index factory.
	 *
	 * @author b.wenneker <b.wenneker@gmail.com>, 2010
	 * @return Application_Model_Factory_Search_Index
	 */
	public static function getIndexFactory ()
	{
		if (self::$_indexFactory === null) {
			self::$_indexFactory = new Application_Model_Factory_Search_Index();
		}
		return self::$_indexFactory;
	}
}